package com.zxy.enums;

import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;
import java.util.Optional;

public enum WareHouseStatus {
    SALE(1,"正常"),
    SHELVES(0,"禁用");

    @Getter
    @Setter
    private Integer code;
    @Getter @Setter
    private String  msg;

    WareHouseStatus(Integer code, String msg){
        this.code = code;
        this.msg = msg;
    }

    public static WareHouseStatus findByCode(Integer code){
        Optional<WareHouseStatus> optional = Arrays.stream(WareHouseStatus.values()).filter(item -> item.getCode().equals(code)).findFirst();
        return optional.orElse(null);
    }

}
